package main

import "fmt"

func main()  {
	var arr = []int{7,4,87,12,54,13,67,81,99}

	fmt.Println(testquick(arr))
}

func testquick(arr []int) []int {
	if len(arr) <= 0 {
		return []int{}
	}

	k := arr[0]
	before,after := []int{},[]int{}

	for i:=1;i<len(arr);i++ {
		if arr[i] <= k {
			before = append(before,arr[i])
		}else {
			after = append(after,arr[i])
		}
	}
	var ret []int
	ret = append(testquick(before),k)
	ret = append(ret,testquick(after)...)
	return ret
}
